--- a/src/Makefile.am	2017-12-21 07:07:13.000000000 +0800
+++ b/src/Makefile.am	2020-12-14 18:58:44.532188819 +0800
@@ -518,7 +518,7 @@ protoc_SOURCES = google/protobuf/compile
 # to build the js_embed binary using $(CXX_FOR_BUILD) so that it is executable
 # on the build machine in a cross-compilation setup.
 js_embed$(EXEEXT): $(srcdir)/google/protobuf/compiler/js/embed.cc
-	$(CXX_FOR_BUILD) -o $@ $<
+	$(CXX_FOR_BUILD) ${CXXFLAGS} ${LDFLAGS} -o $@ $<
 js_well_known_types_sources =                                  \
 	google/protobuf/compiler/js/well_known_types/any.js          \
 	google/protobuf/compiler/js/well_known_types/struct.js       \
